﻿<Window x:Class="Squiggle.Translate.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:props="clr-namespace:Squiggle.Translate.Properties"
        Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded" Closing="Window_Closing">
    <Window.Resources>
        <ObjectDataProvider MethodName="GetValues"
                        ObjectType="{x:Type sys:Enum}"
                        x:Key="DirectionValues">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="FlowDirection" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>

    <Grid x:Name="layoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <StackPanel Grid.ColumnSpan="2" Orientation="Horizontal" Margin="5">
            <Label>Key</Label>
            <TextBox Width="100" x:Name="key" Text="{Binding ApiKey,Source={x:Static props:Settings.Default}}" />
            <Label>Language:</Label>
            <ComboBox x:Name="language" Width="100" DisplayMemberPath="EnglishName" />
            <Label>Direction:</Label>
            <Label x:Name="Direction" Width="100">
                <Label.Style>
                    <Style TargetType="Label">
                        <Setter Property="Content" Value="LeftToRight" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=language, Path=SelectedItem.TextInfo.IsRightToLeft}" Value="True">
                                <Setter Property="Content" Value="RightToLeft" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Label.Style>
            </Label>
            <Button Content="Translate" Click="Button_Click">
                <Button.Style>
                    <Style TargetType="Button">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Text,ElementName=language}" Value="">
                                <Setter Property="IsEnabled" Value="False" />
                            </DataTrigger>
                            <!--<DataTrigger Binding="{Binding Text,ElementName=key}" Value="">
                                <Setter Property="IsEnabled" Value="False" />
                            </DataTrigger>-->
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
        </StackPanel>
        <TextBox Grid.Row="1" x:Name="inputText" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" IsReadOnly="True"  />
        <TextBox Grid.Row="1" Grid.Column="1" x:Name="outputText" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" IsReadOnly="False"   />
    </Grid>
</Window>
